/**
 * 
 */
package net.sisgac.atencion_cliente.model.dao.jpa;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import net.sisgac.atencion_cliente.model.Mercaderia;
import net.sisgac.atencion_cliente.model.dao.MercaderiaDAO;


/**
 * @author Luis Yarleque
 *
 */
@SuppressWarnings("unchecked")
public class JPAMercaderiaDAO implements MercaderiaDAO{
	
	private EntityManager em;
	
	
	public JPAMercaderiaDAO(EntityManager em){
		this.em=em;
	}
	
	

	@Override
	public List<Mercaderia> findAll() {
		// TODO Auto-generated method stub
		Query query=em.createQuery("Select o From detalle_oservicio o");
		return query.getResultList();
	}
	
	public void delete(Mercaderia mercaderia){
		Mercaderia remove = em.find(Mercaderia.class, mercaderia.getIdMercaderia());
		em.remove(remove);
	}

}
